module.exports = app => {
    const { STRING, INTEGER, TEXT, DATE, BIGINT, TINYINT } = app.Sequelize;

    const User = app.model.define('user', {
        user_id: {
            type: BIGINT.UNSIGNED,
            primaryKey: true,
            autoIncrement: true,
        },
        nickname: { type: STRING(50), allowNull: true },
        phone: { type: STRING(11), allowNull: false, unique: true },
        email: { type: STRING(30), allowNull: false, unique: true },
        password: { type: STRING(100), allowNull: false },
        real_name: { type: STRING(20), allowNull: true },
        student_id: { type: STRING(20), allowNull: true, unique: true },
        avatar: { type: STRING(255), allowNull: true },
        bio: { type: STRING(255), allowNull: true },
        city: { type: STRING(50), allowNull: true },
        company: { type: STRING(100), allowNull: true },
        position: { type: STRING(50), allowNull: true },
        verification_status: { type: TINYINT, allowNull: true, defaultValue: 0 },
        gender: { type: TINYINT, allowNull: true },
        address: { type: STRING(100), allowNull: true },
        created_at: DATE,
        updated_at: DATE,
    }, {
        tableName: 'users',
        timestamps: false,
    });

    return User;
};